package com.service;

import com.core.contant.BusinessExceptionCode;
import com.core.exception.BusinessException;
import org.mybatis.spring.annotation.MapperScan;

/**
 * Created by dawn on 2017/11/15.
 */
@MapperScan("com.mapper")
public class BaseService {
    protected BusinessException buildBusinessException(BusinessExceptionCode exceptionCode) {
        return new BusinessException(exceptionCode.getErrorCode(), exceptionCode.getErrorMsg());
    }

    protected BusinessException buildBusinessException(BusinessExceptionCode exceptionCode, Object... arguments) {
        return new BusinessException(exceptionCode.getErrorCode(), String.format(exceptionCode.getErrorMsg(), arguments));
    }
}
